$(function(){
    $.extend({
        tips: {
            show: function(params){
                $.tips.hide()
                this.params = params
                var overlay = $('<div class="ui-mask"></div>')
                var tempStr = `<div id="ui-tips" class="ui-tips show">
                                    <div class="ui-tips-title">${params.title}</div>
                                    <div class="ui-tips-content">${params.content}</div>
                                    <div class="ui-tips-button">${params.button}</div>
                                </div>`
                var template = $(tempStr)
                $('body').append(template).append(overlay)
                $(document).on('click','.ui-tips-button', function(){
                    $.tips.hide()
                })
            },
            hide: function(){
                $('div.ui-mask').remove();
                $('#ui-tips').remove();
            }
        },
        drag: {
            load: function(){
                var doc = document.documentElement
                var isDrag = false
                var textDom = $('#drag')
                var initX = 0
                doc.addEventListener('touchstart', function(e){
                    initX = e.targetTouches[0].pageX
                    isDrag = true
                }, false)
                doc.addEventListener('touchmove', function(e){
                    var distance = initX - e.targetTouches[0].pageX
                    console.log(distance)
                }, false)
                
            },
            reload: function(){

            }
        }
    })
})